package com.ruoyi.project.charging.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.charging.domain.TChargingMqttMsgConvert;
import com.ruoyi.project.charging.service.ITChargingMqttMsgConvertService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 岸电MQTT消息转换后的消息数据Controller
 * 
 * @author Yaoxuan Mo
 * @date 2025-07-28
 */
@RestController
@RequestMapping("/charging/convert")
public class TChargingMqttMsgConvertController extends BaseController
{
    @Autowired
    private ITChargingMqttMsgConvertService tChargingMqttMsgConvertService;

    /**
     * 查询岸电MQTT消息转换后的消息数据列表
     */
    @PreAuthorize("@ss.hasPermi('charging:convert:list')")
    @GetMapping("/list")
    public TableDataInfo list(TChargingMqttMsgConvert tChargingMqttMsgConvert)
    {
        startPage();
        List<TChargingMqttMsgConvert> list = tChargingMqttMsgConvertService.selectTChargingMqttMsgConvertList(tChargingMqttMsgConvert);
        return getDataTable(list);
    }

    /**
     * 导出岸电MQTT消息转换后的消息数据列表
     */
    @PreAuthorize("@ss.hasPermi('charging:convert:export')")
    @Log(title = "岸电MQTT消息转换后的消息数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TChargingMqttMsgConvert tChargingMqttMsgConvert)
    {
        List<TChargingMqttMsgConvert> list = tChargingMqttMsgConvertService.selectTChargingMqttMsgConvertList(tChargingMqttMsgConvert);
        ExcelUtil<TChargingMqttMsgConvert> util = new ExcelUtil<TChargingMqttMsgConvert>(TChargingMqttMsgConvert.class);
        util.exportExcel(response, list, "岸电MQTT消息转换后的消息数据数据");
    }

    /**
     * 获取岸电MQTT消息转换后的消息数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('charging:convert:query')")
    @GetMapping(value = "/{msgConvertId}")
    public AjaxResult getInfo(@PathVariable("msgConvertId") String msgConvertId)
    {
        return success(tChargingMqttMsgConvertService.selectTChargingMqttMsgConvertByMsgConvertId(msgConvertId));
    }

    /**
     * 新增岸电MQTT消息转换后的消息数据
     */
    @PreAuthorize("@ss.hasPermi('charging:convert:add')")
    @Log(title = "岸电MQTT消息转换后的消息数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TChargingMqttMsgConvert tChargingMqttMsgConvert)
    {
        return toAjax(tChargingMqttMsgConvertService.insertTChargingMqttMsgConvert(tChargingMqttMsgConvert));
    }

    /**
     * 修改岸电MQTT消息转换后的消息数据
     */
    @PreAuthorize("@ss.hasPermi('charging:convert:edit')")
    @Log(title = "岸电MQTT消息转换后的消息数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TChargingMqttMsgConvert tChargingMqttMsgConvert)
    {
        return toAjax(tChargingMqttMsgConvertService.updateTChargingMqttMsgConvert(tChargingMqttMsgConvert));
    }

    /**
     * 删除岸电MQTT消息转换后的消息数据
     */
    @PreAuthorize("@ss.hasPermi('charging:convert:remove')")
    @Log(title = "岸电MQTT消息转换后的消息数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{msgConvertIds}")
    public AjaxResult remove(@PathVariable String[] msgConvertIds)
    {
        return toAjax(tChargingMqttMsgConvertService.deleteTChargingMqttMsgConvertByMsgConvertIds(msgConvertIds));
    }
}
